Optimal. Leaf size=80 \[ 2 a^2 (c-i d) x-\frac {2 a^2 (i c+d) \log (\cos (e+f x))}{f}-\frac {a^2 (c-i d) \tan (e+f x)}{f}+\frac {d (a+i a \tan (e+f x))^2}{2 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {3608, 3558,
3556} \begin {gather*} -\frac {a^2 (c-i d) \tan (e+f x)}{f}-\frac {2 a^2 (d+i c) \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)+\frac {d (a+i a \tan (e+f x))^2}{2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3558
Rule 3608
Rubi steps
\begin {align*} \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx &=\frac {d (a+i a \tan (e+f x))^2}{2 f}-(-c+i d) \int (a+i a \tan (e+f x))^2 \, dx\\ &=2 a^2 (c-i d) x-\frac {a^2 (c-i d) \tan (e+f x)}{f}+\frac {d (a+i a \tan (e+f x))^2}{2 f}+\left (2 a^2 (i c+d)\right ) \int \tan (e+f x) \, dx\\ &=2 a^2 (c-i d) x-\frac {2 a^2 (i c+d) \log (\cos (e+f x))}{f}-\frac {a^2 (c-i d) \tan (e+f x)}{f}+\frac {d (a+i a \tan (e+f x))^2}{2 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(263\) vs. \(2(80)=160\).
time = 1.86, size = 263, normalized size = 3.29 \begin {gather*} \frac {a^2 \sec (e) \sec ^2(e+f x) (\cos (2 f x)+i \sin (2 f x)) \left (-8 (c-i d) \text {ArcTan}(\tan (3 e+f x)) \cos (e) \cos ^2(e+f x)-i \left (4 i c f x \cos (3 e+2 f x)+4 d f x \cos (3 e+2 f x)+(i c+d) \cos (e+2 f x) \left (4 f x-i \log \left (\cos ^2(e+f x)\right )\right )+c \cos (3 e+2 f x) \log \left (\cos ^2(e+f x)\right )-i d \cos (3 e+2 f x) \log \left (\cos ^2(e+f x)\right )+2 \cos (e) \left (-i d+4 i c f x+4 d f x+(c-i d) \log \left (\cos ^2(e+f x)\right )\right )+2 i c \sin (e)+4 d \sin (e)-2 i c \sin (e+2 f x)-4 d \sin (e+2 f x)\right )\right )}{4 f (\cos (f x)+i \sin (f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.11, size = 76, normalized size = 0.95
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {d \left (\tan ^{2}\left (f x +e \right )\right )}{2}-c \tan \left (f x +e \right )+2 i \tan \left (f x +e \right ) d +\frac {\left (2 i c +2 d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-2 i d +2 c \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(76\) |
default | \(\frac {a^{2} \left (-\frac {d \left (\tan ^{2}\left (f x +e \right )\right )}{2}-c \tan \left (f x +e \right )+2 i \tan \left (f x +e \right ) d +\frac {\left (2 i c +2 d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-2 i d +2 c \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(76\) |
norman | \(\left (-2 i a^{2} d +2 a^{2} c \right ) x -\frac {\left (-2 i a^{2} d +a^{2} c \right ) \tan \left (f x +e \right )}{f}-\frac {a^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (i a^{2} c +a^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) | \(87\) |
risch | \(\frac {4 i a^{2} d e}{f}-\frac {4 a^{2} c e}{f}-\frac {2 a^{2} \left (i c \,{\mathrm e}^{2 i \left (f x +e \right )}+3 \,{\mathrm e}^{2 i \left (f x +e \right )} d +i c +2 d \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}-\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d}{f}-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c}{f}\) | \(120\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 87, normalized size = 1.09 \begin {gather*} -\frac {a^{2} d \tan \left (f x + e\right )^{2} - 4 \, {\left (a^{2} c - i \, a^{2} d\right )} {\left (f x + e\right )} - 2 \, {\left (i \, a^{2} c + a^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \, {\left (a^{2} c - 2 i \, a^{2} d\right )} \tan \left (f x + e\right )}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.05, size = 141, normalized size = 1.76 \begin {gather*} -\frac {2 \, {\left (i \, a^{2} c + 2 \, a^{2} d + {\left (i \, a^{2} c + 3 \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, a^{2} c + a^{2} d + {\left (i \, a^{2} c + a^{2} d\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (i \, a^{2} c + a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.32, size = 122, normalized size = 1.52 \begin {gather*} - \frac {2 i a^{2} \left (c - i d\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 2 i a^{2} c - 4 a^{2} d + \left (- 2 i a^{2} c e^{2 i e} - 6 a^{2} d e^{2 i e}\right ) e^{2 i f x}}{f e^{4 i e} e^{4 i f x} + 2 f e^{2 i e} e^{2 i f x} + f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 228 vs. \(2 (73) = 146\).
time = 0.53, size = 228, normalized size = 2.85 \begin {gather*} -\frac {2 \, {\left (i \, a^{2} c e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + a^{2} d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 2 i \, a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 2 \, a^{2} d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} + 3 \, a^{2} d e^{\left (2 i \, f x + 2 i \, e\right )} + i \, a^{2} c \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + a^{2} d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, a^{2} c + 2 \, a^{2} d\right )}}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.07, size = 76, normalized size = 0.95 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,d\,1{}\mathrm {i}+a^2\,\left (d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (2\,a^2\,d+a^2\,c\,2{}\mathrm {i}\right )}{f}-\frac {a^2\,d\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________